function [Model, AllDist] = Ddavid_svdd(AllData, Label, Arg, C)

% [Model, AllDist] = Ddavid_svdd(AllData, Label, TargetValue, Arg, C)
%
% <Input>
% AllData: [n*m], n is the number of data instances, m is the number of
%                 features
% Label: [n*1]
% Arg: double
% C: double
%
% <Output>
% Model
% AllDist: [n*1]

% disp(Arg);

% label filter
TargetData = AllData(Label(:) == 1, :);

% initialization
options = struct('method', 'CG', 'ker', 'rbf', 'arg', Arg, 'C', C);

% SVDD on sampled data
data.X = TargetData';   % data.X: input patterns
Model = svdd(data.X, options);
AllDist = kdist2(AllData', Model);

return;
